<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Object.getOwnPropertyDescriptors()</title>
</head>
<body>
    <h1>Object.getOwnPropertyDescriptors()</h1>
    <h2>返回指定对象所有自身属性的描述对象</h2>

    <script>
        const obj = {
            name: '张三',
            get age() { return 18; }
        };

        console.log(Object.getOwnPropertyDescriptors(obj));
        /*
        {
          name: {
            value: '张三',
            writable: true,
            enumerable: true,
            configurable: true
          },
          age: {
            get: [Function: get age],
            set: undefined,
            enumerable: true,
            configurable: true
          }
        }
        */
    </script>
</body>
</html> 